<template>
  <div class="app-container">
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span style="font-size: 20px;font-weight: 700;">代理设置</span>
      </div>
      <div class="put">
        <el-form ref="form" :model="form" label-width="120px" style="width:500px;" :rules="rules">
          <el-form-item label="秘钥" prop="secret">
            <el-input v-model="form.secret "></el-input>
          </el-form-item>
          <el-form-item label="订单编号" prop="orderNo">
            <el-input v-model="form.orderNo "></el-input>
          </el-form-item>
          <el-form-item label="余额">
            <el-input v-model="form.balance" disabled>
              <i class="el-icon-edit el-icon-refresh-right" slot="suffix" @click="handleIconClick">
              </i>
            </el-input>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="submitForm()">设置</el-button>
            <el-button type="primary" @click="resetForm()" disabled>开启</el-button>
          </el-form-item>
        </el-form>
      </div>
    </el-card>
  </div>
</template>

<script>
  import {
    updateConfig,
    getProxyConfig
  } from "@/api/merchant/proxy";

  export default {
    name: "AccountProxy",
    data() {
      return {
        form: {
          secret: '',
          orderNo: '',
          balance: 0
        },
        rules: {
          secret: [{
            required: true,
            message: '请输入秘钥',
            trigger: 'blur'
          }, ],
          orderNo: [{
            required: true,
            message: '请输入订单编号',
            trigger: 'blur'
          }, ],
        }
      };
    },
    created() {
      getProxyConfig().then(response => {
        this.form = response.data;
      });
    },
    methods: {
      submitForm() {
          updateConfig(this.form).then(response=>{
              console.log("111");
          });
      },
      resetForm() {

      },
      handleIconClick() {
        console.log(123);
      }
    }
  };

</script>
<style scoped>
  ::v-deep .el-form-item__label {
    font-size: 18px;
    font-weight: 400;
     }

</style>
